Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first version of reprex and addins #28

Merged
merged 2 commits into from
Aug 26, 2022
Merged

first version of reprex and addins #28

merged 2 commits into from
Aug 26, 2022

Conversation

DavZim
Copy link

@DavZim DavZim commented Apr 8, 2022

This is a first version of the reprex/addins feature request (#27).

The code in the PR should work but is not finished, instead, this PR has the goal to be a basis for discussion.

This code adds two functions which act like a reprex, create a reprex and carbonify(?) the output of the reprex either opening the browser or downloading the file directly.

Additionally, RStudio addins are added to make it easier to use and potentially bind it to keyboard shortcuts.

Contrary to the issue, this uses reprex, therefore selected code is not used, instead code from the clipboard is used (which is imo more user friendly).

Let me know if this makes it more clear and if this is something that could be included (if more tests are added etc).

Thanks

@yonicd
Copy link
Owner

yonicd commented Apr 8, 2022

thanks for the PR. will take a closer look over the weekend.

@DavZim
Copy link
Author

DavZim commented Apr 25, 2022

Any opinions on this?

@yonicd
Copy link
Owner

yonicd commented Apr 25, 2022

Working on the other PR at the moment.

This looks good.

Once the new version is up I'll weave this PR into it.

Thanks!

merging updated master into PR
@yonicd
Copy link
Owner

yonicd commented Apr 28, 2022

Had a chance to give it a spin.

Overall it looks good. A few things that would need to be updated

  • use rstudioapi to capture highlighted text from the editor when running as addin
  • if any device output is generated (png) capture it (or its url) and add it as an image object to the parent carbon object

@DavZim
Copy link
Author

DavZim commented Apr 29, 2022

I tend to agree that the addin should not only work from clipboard but also from selected code. As we use ... to pass all arguments to reprex, I am not sure how we can achieve this. One way would be to limit the addin to use only selected code and do not work with code on the clipboard.

Ad 2. How can we combine the parent carbon object with the imgur reprex image? This should be optional as for example in my case I rarely want to have the image in the carbon as well

@yonicd
Copy link
Owner

yonicd commented Apr 29, 2022

  1. That is what i meant. to have addin only work on highlighted text.
  • addins need to be input type specific, ie you can have two addins, one for clipboard one for editor.
  1. Carbon objects can also share the content (eg tweets). it would make most sense to keep the side effects reprex generates to attached to the content that carbon is sharing.

@yonicd yonicd merged commit 84d98b8 into yonicd:master Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants